const state = {
  header: {
    show:true,
    title:"",
    leftText:"",
    rightText:"",
    leftIcon:"",
    rightIcon:"",
    clickRight:function(){},
    clickLeft:function(){},
    opacity:1
  }
}

// getters
const getters = {
   getHeader(state){
     return  state.header
   }
}

// actions
const actions = {
  getHeader({commit}){    
    return  commit('getHeader')
  },
  setHeaderStatus ({ state, commit }, status) {    
    commit('changeHeaderStatus',status)  
  },
  setHeader({state, commit},header){
    commit('setHeaher',header) 
  }
}

// mutations
const mutations = {
  getHeader(state){
    console.log(state.header)
    return  state.header
  },
  setHeaher(state, header){
    for(var i in header){
      state.header[i] = header[i]
    }
    console.log(state.header)
  },
  changeHeaderStatus (state, status) {
    state.header.show = status
  }
}

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
}